
package de.sscoolapps.vokabeltrainer;


/*
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.view.LayoutInflater.Factory;

public class DataBase {

	DataBase(){
	
		
	SQLiteDatabase db;
	Factory CF = SQLiteDatabase.CREATE_IF_NECESSARY;

	db.openOrCreateDatabase("test.db", factory);
		
	
	
	
    db.openOrCreateDatabase(
           "TestingData.db"
           , SQLiteDatabase.CREATE_IF_NECESSARY
           , null
           );
    db.setVersion(1);
    db.setLocale(Locale.getDefault());
    db.setLockingEnabled(true);

    final String CREATE_TABLE_COUNTRIES =
        "CREATE TABLE tbl_countries ("
        + "id INTEGER PRIMARY KEY AUTOINCREMENT,"
        + "country_name TEXT);";
    final String CREATE_TABLE_STATES =
        "CREATE TABLE tbl_states ("
        + "id INTEGER PRIMARY KEY AUTOINCREMENT,"
        + "state_name TEXT,"
        + "country_id INTEGER NOT NULL CONSTRAINT "
        + "contry_id REFERENCES tbl_contries(id) "
        + "ON DELETE CASCADE);";
    db.execSQL(CREATE_TABLE_COUNTRIES);
    db.execSQL(CREATE_TABLE_STATES);
    final String CREATE_TRIGGER_STATES =
        "CREATE TRIGGER fk_insert_state BEFORE "
        + "INSERT on tbl_states"
        + "FOR EACH ROW "
        + "BEGIN "
        + "SELECT RAISE(ROLLBACK, 'insert on table "
        + ""tbl_states" voilates foreign key constraint "
        + ""fk_insert_state"') WHERE (SELECT id FROM "
        + "tbl_countries WHERE id = NEW.country_id) IS NULL; "
        + "END;";
    db.execSQL(CREATE_TRIGGER_STATES);
	
	}
	
}
public static abstract class FeedEntry implements BaseColumns {
    public static final String TABLE_NAME = "entry";
    public static final String COLUMN_NAME_ENTRY_ID = "entryid";
    public static final String COLUMN_NAME_TITLE = "title";
    public static final String COLUMN_NAME_SUBTITLE = "subtitle";
    ...
}

//Prevents the FeedReaderContract class from being instantiated.
private FeedReaderContract() {}


private static final String TEXT_TYPE = " TEXT";
private static final String COMMA_SEP = ",";
private static final String SQL_CREATE_ENTRIES =
    "CREATE TABLE " + FeedReaderContract.FeedEntry.TABLE_NAME + " (" +
    FeedReaderContract.FeedEntry._ID + " INTEGER PRIMARY KEY," +
    FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + TEXT_TYPE + COMMA_SEP +
    FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE + TEXT_TYPE + COMMA_SEP +
    ... // Any other options for the CREATE command
    " )";

private static final String SQL_DELETE_ENTRIES =
    "DROP TABLE IF EXISTS " + TABLE_NAME_ENTRIES;

public class FeedReaderDbHelper extends SQLiteOpenHelper {
    // If you change the database schema, you must increment the database version.
    public static final int DATABASE_VERSION = 1;
    public static final String DATABASE_NAME = "FeedReader.db";

    public FeedReaderDbHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(SQL_CREATE_ENTRIES);
    }
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // This database is only a cache for online data, so its upgrade policy is
        // to simply to discard the data and start over
        db.execSQL(SQL_DELETE_ENTRIES);
        onCreate(db);
    }
    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        onUpgrade(db, oldVersion, newVersion);
    }
}

//Gets the data repository in write mode
SQLiteDatabase db = mDbHelper.getWritableDatabase();

//Create a new map of values, where column names are the keys
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID, id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE, title);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CONTENT, content);

//Insert the new row, returning the primary key value of the new row
long newRowId;
newRowId = db.insert(
      FeedReaderContract.FeedEntry.TABLE_NAME,
      FeedReaderContract.FeedEntry.COLUMN_NAME_NULLABLE,
      values);


SQLiteDatabase db = mDbHelper.getReadableDatabase();

//Define a projection that specifies which columns from the database
//you will actually use after this query.
String[] projection = {
 FeedReaderContract.FeedEntry._ID,
 FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE,
 FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED,
 ...
 };

//How you want the results sorted in the resulting Cursor
String sortOrder =
 FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED + " DESC";

Cursor c = db.query(
 FeedReaderContract.FeedEntry.TABLE_NAME,  // The table to query
 projection,                               // The columns to return
 selection,                                // The columns for the WHERE clause
 selectionArgs,                            // The values for the WHERE clause
 null,                                     // don't group the rows
 null,                                     // don't filter by row groups
 sortOrder                                 // The sort order
 );


*/
